﻿@section header{

}
<form id="form1">
    <div class="form-layout">
        <input type="hidden" name="ID" value="" />
        <table class="form">
            <tr>
                <th class="formTitle">上一级</th>
                <td class="formValue">
                    <select id="ParentID" name="ParentID" class="form-control required">
                        <option value="0">父节点</option>
                    </select>
                </td>
            </tr>
            <tr>
                <th class="formTitle">模块标识</th>
                <td class="formValue">
                    <input id="Code" name="Code" type="text" class="form-control " autocomplete="off" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">模块名称</th>
                <td class="formValue">
                    <input id="Name" name="Name" type="text" class="form-control " autocomplete="off" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">URL</th>
                <td class="formValue">
                    <input id="Url" name="Url" type="text" class="form-control " autocomplete="off" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">图标</th>
                <td class="formValue">
                    <div class="input-group">
                        <input id="Icon" name="Icon" type="text" class="form-control " />
                        <span class="input-group-btn">
                            <a class="btn  btn-primary"><i class="fa fa-ellipsis-h"></i></a>
                        </span>
                    </div>
                </td>
            </tr>
            <tr>
                <th class="formTitle">有效</th>
                <td class="formValue">
                    <div class="ckbox">
                        <input id="Status" name="Status" type="checkbox" checked="checked"><label for="Status">启用</label>
                    </div>
                </td>
            </tr>
            <tr>
                <th class="formTitle">是否系统模块</th>
                <td class="formValue">
                    <div class="ckbox">
                        <input id="IsSys" name="IsSys" type="checkbox" checked="checked"><label for="IsSys">启用</label>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</form>
@section scripts{
    <script>
        var baseUrl = "/rbac/Menu/";
        var keyValue = $.request("keyValue");
        $(function () {
            initControl();
            if (!!keyValue) {
                $.ajax({
                    url: baseUrl + "GetFormJson",
                    type:"POST",
                    data: { keyValue: keyValue },
                    dataType: "json",
                    async: false,
                    success: function (data) {
                        $("#form1").formSerialize(data);
                    }
                });
            }
        });
        function initControl() {
            $("#ParentID").bindSelect({
                url: baseUrl+"GetTreeSelectJson",
            });
        }
        function submitForm() {
            if (!$('#form1').formValid()) {
                return false;
            }
            $.submitForm({
                url: baseUrl + "SubmitForm?keyValue=" + keyValue,
                param: $("#form1").formSerialize(),
                success: function () {
                    $.currentWindow().$("#gridList").resetSelection();
                    $.currentWindow().$("#gridList").trigger("reloadGrid");
                }
            })
        }
    </script>
}